package 算法练习;/**
 * @author： li
 * @date： 2022-01-09 20:22
 * @version 1.0
 */

/**
 * @author： ljm
 * @date： 2022-01-09 20:22
 * @version 1.0
 */
import java.util.Scanner;
public class 礼物03_二分法 {
    private static int n;
    private static long s;
    private static long[] sum = new long[(int) (1e6+5)];
    private static int l=1;
    private static int r= (int) 1e6;
    public static boolean check(int tem){
        for(int i=tem;i<=n-tem;i++){
            if(sum[i]-sum[i-tem]<=s&&sum[i+tem]-sum[i]<=s){//当答案存在时 返回true
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        s = sc.nextLong();
        String[] strings = new String[n+1];
        for (int i = 1; i <=n; i++) {
            strings[i] =sc.next();
            sum[i]= Long.parseLong(strings[i])+sum[i-1];
        }
        while(l<r){
            int mid=(l+r+1)/2;
            if(check(mid))
                l=mid;
            else
                r=mid-1;
        }
        System.out.println(2*l);
    }
}
